<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="./js/jquery.js"></script>
<script type="text/javascript" src="./js/jquery.cookie.js"></script>
</head>
<body>

	<div align="center">
		<h2>添加员工</h2>
		员工姓名：<input id="ename" type="text" placeholder="请输入员工姓名" /><br>
		员工职位： <input id="job" type="text"><br>
		员工上司：<input id="mgr" type="number"><br> 
		员工入职时间：<input id="hiredate" type="date" placeholder="请输入员工入职时间" /><br> 
		员工薪资：<input id="sal" type="number" placeholder="请输入员工薪资" /><br> 
		员工奖金：<input id="comm" type="number" placeholder="请输入员工奖金" /><br> 
		员工部门编号：<input id="deptno" type="number"><br> 
		<input type="button"onclick="AddFun()" value="点击提交">
	</div>
	
	<script type="text/javascript">
		function AddFun(){
			
			var ename = $("#ename").val();
			var job = $("#job").val();
			var mgr = $("#mgr").val();
			var hiredate = $("#hiredate").val();
			var sal = $("#sal").val();
			var comm = $("#comm").val();
			var deptno = $("#deptno").val();
			
			var json = {
					"ename":ename,
					"job":job,
					"mgr":mgr,
					"hiredate":hiredate,
					"sal":sal,
					"COMM":comm,
					"deptno":deptno,
			}
			var str = JSON.stringify(json);
			
			$.ajax({
				url:"empOneAdd",
				type:"post",
				data:str,
				async:true,
				dataType:"json",
				success:function(result){
					alert(result.comment);
					window.location.href = "http://localhost:8080/DyTransaction/main.html";
				},
				error:function(error){
					console.error("失败");
				}
			})
		}
	</script>
</body>
</html>